home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
BUS
/
TMCM Software and Labs.sit
/
Software for TMCM 7_95
/
Files for Lab 13
/
TwoTasks
< prev
Wrap
Text File
|
1995-07-07
|
718b
|
40 lines
{
It is possible to use multitasking in xTurtle to perform
any two or more tasks simultaneously. In this example,
two turtles perform independent "random walks".
When you run this program, you will need to use the
"Kill Program" command in the "Run" menu to stop it.
}
fork(2) { Split into two turtles }
IF ForkNumber = 1 THEN
{ Task to be performed by turtle #1... }
PenUp
MoveTo(3,0)
PenDown
LOOP
face(90 * randomInt(4))
forward(0.5)
EXIT IF 1=2
END LOOP
OR IF ForkNumber = 2 THEN
{ Task to be performed by turtle #2... }
PenUp
MoveTo(-3,0)
PenDown
LOOP
face(120 * randomInt(3))
forward(0.5)
EXIT IF 1=2
END LOOP
END IF